<?php	require_once(dirname(__FILE__).'/inc/config.inc.php'); ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台首页</title>
<link href="templates/style/admin_diy.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="templates/myCss/backend.min.css">
<script type="text/javascript" src="templates/js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
	//控制便签
	$("#homeNote").focus(function(){
		$(".notearea").addClass("borderOn");
		if($.trim($(this).val()) == "点击输入便签内容..."){
			$(this).val("");
		}
	}).blur(function(){
		$(".notearea").removeClass("borderOn");
		if($.trim($(this).val()) == ""){
			$.ajax({
				url : "ajax_do.php",
				type:'post',
				data:{"action":"deladminnotes"},
				dataType:'html',
				success:function(data){	
				}
			});
			$(this).val("点击输入便签内容...");
		}else{
			$.ajax({
				url : "ajax_do.php",
				type:'post',
				data:{"action":"adminnotes", "body":$.trim($(this).val())},
				dataType:'html',
				success:function(data){
				}
			});
		}
	});

	$("#showad").html('<iframe src="showad.php" width="100%" height="25" scrolling="no" frameborder="0" allowtransparency="true"></iframe>');
});
</script>
</head>
<body class="inside-header inside-aside " marginwidth="0" marginheight="0">
<div id="main" role="main">
<div class="tab-content tab-addtabs">
<div id="content">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

	<div id="ribbon">
		<ol class="breadcrumb pull-left">
			<li><a href="dashboard" class="addtabsit"><i class="fa fa-home"></i> 首页</a></li>
		</ol>
		<ol class="breadcrumb pull-right">
			<li><a href="javascript:location.reload();" class="reload">刷新</a></li>
		</ol>
	</div>

	<div class="content">
		<div class="panel panel-default panel-intro">
			<div class="panel-heading">
				<div class="homeHeader">
					<div class="news">
						<div class="title">官方公告</div>
						<div id="showad"> </div>
					</div>
				</div>
			</div>
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade active in" id="one">
						<div class="row">
							<div class="box-header">
								<span class="box-title">快捷</span>
								<span class="pull-right"><a href="lnk.php">更多&gt;&gt;</a></span>
							</div>
							<?php
								$dosql->Execute("SELECT * FROM `#@__lnk` ORDER BY orderid ASC LIMIT 0, 8");
								while($row = $dosql->GetArray())
								{
									$dbName = '#@__'.str_replace(".php","",$row['lnklink']);
									$num = $dosql->GetOne("SELECT COUNT(*) FROM `".$dbName."`");
									echo '<div class="col-sm-3 col-xs-6">';
									echo '<div class="sm-st clearfix">';
									echo '<span class="sm-st-icon" style="background: '.$row['bgcolor'].'">';
									echo '<a href="'.$row['lnklink'].'" style="color:#fff"><i class="fa '.$row['lnkico'].'"></i></a></span>';
									echo '<div class="sm-st-info">';
									echo '<span>'.$num['COUNT(*)'].'</span>'.$row['lnkname'];
									echo '</div></div></div>';
								}
							?>
						</div>
					</div>
					<div class="row">
						<div class="col-lg-12">
							<div class="box-header">
								<span class="box-title">日志</span>
								<span class="pull-right"><a href="sysevent.php">更多&gt;&gt;</a></span>
							</div>
							<div class="box-body">
							<ul>
								<?php
								$sql = "SELECT * FROM `#@__sysevent` ORDER BY `id` DESC LIMIT 0,2";

								$dosql->Execute($sql);
								while($row = $dosql->GetArray())
								{
									$r = $dosql->GetOne("SELECT `sitename` FROM `#@__site` WHERE `id`=".$row['siteid']);
									if(empty($r)) $r['sitename'] = '未知站点';

									if($row['model'] == 'login')
									{
								?>
								<li><?php echo MyDate('m-d H:i',$row['posttime']); ?>：用户 <strong><?php echo $row['uname']; ?></strong> 进行了 <span class="blue">登录操作</span> </li>
								<?php
									}
							
									else if($row['model'] == 'logout')
									{
								?>
								<li> <?php echo MyDate('m-d H:i',$row['posttime']); ?>：用户 <strong><?php echo $row['uname']; ?></strong> 进行了 <span class="blue">退出操作</span> </li>
								<?php
									}
									else if($row['classid'] != 0)
									{
										$r2 = $dosql->GetOne("SELECT `classname` FROM `#@__infoclass` WHERE `id`=".$row['classid']);
										
										if($row['action'] == 'add')
											$action = '添加';
										else if($row['action'] == 'update')
											$action = '修改';
										else if($row['action'] == 'del')
											$action = '删除';
										else
											$action = '';
								?>
								<li><?php echo MyDate('m-d H:i',$row['posttime']); ?>：用户 <strong><?php echo $row['uname']; ?></strong> 在 <span class="maroon2"><?php echo $r['sitename']; ?></span> <?php echo $action; ?>了 <span class="blue"><?php echo $r2['classname']; ?></span> </li>
								<?php
									}
									else
									{
								?>
								<li> <?php echo MyDate('m-d H:i',$row['posttime']); ?>：用户 <strong><?php echo $row['uname']; ?></strong> 在 <span class="maroon2"><?php echo $r['sitename']; ?></span> 操作了 <span class="blue"><?php echo $row['model']; ?></span> </li>
								<?php
									}
								}
								?>
							</ul>
							</div>
						</div>
					</div>
					<div class="homeCont row">
						<div class="col-lg-6">
							<div class="box box-info">
								<div class="box-header"><h3 class="box-title">服务器信息</h3></div>
								<div class="box-body">
									<table class="table table-striped">
										<tbody>
											<tr>
												<td width="150">软件版本号：</td>
												<td><span title="<?php echo $cfg_vertime; ?>"><?php echo $cfg_vernum; ?></span></td>
											</tr>
											<tr>
												<td>服务器版本：</td>
												<td><span title="<?php echo $_SERVER['SERVER_SOFTWARE']; ?>"><?php echo ReStrLen($_SERVER['SERVER_SOFTWARE'],7,''); ?></span></td>
											</tr>
											<tr>
												<td>操作系统：</td>
												<td><?php echo PHP_OS; ?></td>
											</tr>
											<tr>
												<td>PHP版本号：</td>
												<td><?php echo PHP_VERSION; ?></td>
											</tr>
											<tr>
												<td>GDLibrary：</td>
												<td><?php echo ShowResult(function_exists('imageline')); ?></td>
											</tr>
											<tr>
												<td>MySql版本：</td>
												<td><?php echo $dosql->GetVersion(); ?></td>
											</tr>
											<tr>
												<td>ZEND支持：</td>
												<td><?php echo ShowResult(function_exists('zend_version')); ?></td>
											</tr>
											<tr>
												<td>支持上传的最大文件：</td>
												<td><?php echo ini_get('upload_max_filesize'); ?></td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
						</div>
						<div class="col-lg-6">
							<div class="box box-danger">
								<div class="box-header">
									<h3 class="box-title">统计</h3>
									<div class="box-tools pull-right">
	                                    <a href="syscount.php" class="btn btn-box-tool">更多</a>
	                                </div>
								</div>
								<div class="box-body">
									<table class="table table-striped">
										<tbody>
											<tr>
												<td width="150">网站栏目数：</td>
												<td><?php echo $dosql->GetTableRow('#@__infoclass',$cfg_siteid); ?></td>
											</tr>
											<tr>
												<td>单页信息数：</td>
												<td><?php $dosql->Execute("SELECT `id` FROM `#@__infoclass` WHERE `siteid`='$cfg_siteid' AND `infotype`=0");echo $dosql->GetTotalRow();?></td>
											</tr>
											<tr>
												<td>列表信息数：</td>
												<td><?php echo $dosql->GetTableRow('#@__infolist',$cfg_siteid); ?></td>
											</tr>
											<tr>
												<td>图片信息数：</td>
												<td><?php echo $dosql->GetTableRow('#@__infoimg',$cfg_siteid); ?></td>
											</tr>
											<tr>
												<td>注册会员数：</td>
												<td><?php echo $dosql->GetTableRow('#@__member'); ?></td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
					<div class="homeTeam row">
						<div class="box-header">
							<span class="box-title">团队</span>
						</div>
						<div class="col-lg-4 homeTeam-li">
							<strong>程序开发及交互设计：</strong> <i>Feng</i> · <i>Adu</i>
						</div>
						<div class="col-lg-4 homeTeam-li">
							<strong>荣誉P粉：</strong> <i>奋斗</i> · <i>老徐</i>· <i>CHurricane</i> · <i>火爆浪子</i> · <i>老A</i> · <i>麦子</i> · <i>静望黄昏</i> · <i>小学生</i>
						</div>
						<div class="col-lg-4 homeTeam-li homeTeam-li-nb ">
							<strong>鸣谢：</strong> <i>兔饭饭</i> · <i>游鱼</i> · <i>螺丝钉</i> · <i>薛</i> · <i>风青云</i> · <i>上杉达也</i> · <i>Xyao</i> · <i>Lucifer</i> · <i>leaves</i> · <i>Long</i>
						</div>
					</div>
					<div class="homeNote">
						<h2 class="title">记事</h2>
						<div class="notearea">
							<textarea name="homeNote" id="homeNote"><?php
							$uname    = $_SESSION['admin'];
							$posttime = time();
							$postip   = GetIP();

							$r = $dosql->GetOne("SELECT `body` FROM `#@__adminnotes` WHERE uname='$uname'");
							if(isset($r['body']))
								echo trim($r['body']);
							else
								echo '点击输入便签内容...';
							?></textarea>
						</div>
					</div>
					<div class="homeCopy"> 敬请您将在使用中发现的问题或者不适提交给我们，以便改进 <a href="http://phpmywind.com/bbs/" target="_blank" class="feedback">点击提交反馈</a> | <a href="help.php" class="doc">开发帮助</a> </div>
				</div>
			</div>
		</div>
	</div>	

</div>
</div>
</div>
</div>
</div>


<?php
function ShowResult($revalue)
{
	if($revalue == 1)
		return '<span class="ture">支持</span>';
	else
		return '<span class="flase">不支持</span>';
}
?>
</body>
</html>